feat(tIED): allow IED removal (closes #91).#92
Conversation
|
Currently, this does not remove empty SubNetwork elements if we are removing the last ConnectedAP. I guess we could do something like the following but I worry about over-reach. And I guess we could make it an option. Perhaps we could just wait until it's a problem for someone 😉 function removeWithIedName(ied: Element, iedName: string): Remove[] {
const selector = elementsToRemove
.map((iedNameElement) => `${iedNameElement}[iedName="${iedName}"]`)
.join(",");
return Array.from(ied.ownerDocument.querySelectorAll(selector))
.filter(isPublic)
.map((element) => {
if (
element.tagName === "ConnectedAP" &&
element.parentElement!.querySelectorAll("ConnectedAP").length === 1
) {
return { node: <Element>element.parentElement };
}
return { node: element };
});
} |
JakobVogelsang
left a comment
There was a problem hiding this comment.
That was a pleasure to review. Thank you. Well structure and nice tests. There are just very minor issue that I have spotted.
|
I think an issue marking the fact that the |
a3d7ed9 to
ed98dd9
Compare
ed98dd9 to
17992a6
Compare
|
Thank you for this review, I have made some updates. |
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #91
As always, I would be very grateful for a review.
I'm not removing supervisions using the inbuild unsubscribe functionality because it's implemented "the wrong way" (removal of LNs or DOIs when I want removal of the GoCBRef/SvCBRef > Val's text content). I hope that's acceptable for now.
While I could mostly reuse the test structure for the
updateIEDcode (thank you!), I have redone the test files as I needed the subscriptions and supervisions to be more realistic.Once we have this right, I'd be keen for a new release as I have a menu plugin that I would like to provide in our distribution to allow IED removal.